🎖️GitЯра🎖️
Commit c98410112b3a2380a66a4fcc005e666a6db52d15
Parents : 4ab971d
Author : James Rich <2199651+jamesarich@users.noreply.github.com>
Signature : Signature validation error
Date : 2026-07-01T11:20:36-05:00
Committer : GitHub <noreply@github.com>
Date : 2026-07-01T16:20:36Z
test(settings): fix flaky DebugViewModelTest presetFilters date assertion (#6045)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Changes
1 files changed, 15 insertions(+), 3 deletions(-)
Diff
diff --git a/feature/settings/src/commonTest/kotlin/org/meshtastic/feature/settings/debugging/DebugViewModelTest.kt b/feature/settings/src/commonTest/kotlin/org/meshtastic/feature/settings/debugging/DebugViewModelTest.kt
index e0cbe7b833..6e61dc94d9 100644
--- a/feature/settings/src/commonTest/kotlin/org/meshtastic/feature/settings/debugging/DebugViewModelTest.kt
+++ b/feature/settings/src/commonTest/kotlin/org/meshtastic/feature/settings/debugging/DebugViewModelTest.kt
@@ -143,15 +143,27 @@ class DebugViewModelTest {
fun `presetFilters includes my node ID and broadcast`() {
nodeRepository.setMyNodeInfo(org.meshtastic.core.testing.TestDataFactory.createMyNodeInfo(myNodeNum = 12345678))
+ // presetFilters reads the real wall clock (nowInstant) for its date element, so bracket that
+ // read: the instant the VM used lies between `before` and `after`, meaning its short-date must
+ // equal one of the two bounds. Keeps the assertion deterministic even when the wall clock
+ // crosses a minute boundary between the VM's read and the test's.
+ val before = org.meshtastic.core.common.util.nowInstant.toEpochMilliseconds()
val filters = viewModel.presetFilters
+ val after = org.meshtastic.core.common.util.nowInstant.toEpochMilliseconds()
+
+ val validDates =
+ setOf(
+ org.meshtastic.core.common.util.DateFormatter.formatShortDate(before),
+ org.meshtastic.core.common.util.DateFormatter.formatShortDate(after),
+ )
+ (filters[3] in validDates) shouldBe true
+
filters.shouldBe(
listOf(
"!00bc614e",
"!ffffffff",
"decoded",
- org.meshtastic.core.common.util.DateFormatter.formatShortDate(
- org.meshtastic.core.common.util.nowInstant.toEpochMilliseconds(),
- ),
+ filters[3], // validated above against the bracketed wall-clock reads
) + org.meshtastic.proto.PortNum.entries.map { it.name },
)
}
Served by rngit 1.5.2 - Generated in 0.12s